home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / pc / GB_FMINT.ZIP / SRC / OBJPCX.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1997-01-27  |  1.5 KB  |  62 lines

  1. { XtaC }
  2. unit OBJPCX;
  3. interface
  4. Uses Crt;
  5. {This links the PCX object file to the executable code}
  6. Type Virtual = Array[0..64000] Of Byte;
  7.       VirtPtr = ^Virtual;
  8. {Same here}
  9. Const Vga = $A000;
  10.  
  11. {Now... This is a direct pointer to the picture's array [320x200]=64000}
  12. {So it stores the info in the PicPtr Array}
  13.  
  14. Var VirtScr: VirtPtr;{Get a life}
  15.     VAddr: Word;
  16.     PalOffset: LongInt;
  17.  
  18. Procedure SetPCXPal(PCX: VirtPtr;PicSize: LongInt);
  19. procedure pic;
  20. procedure ReadObjPcx(gseg: word;PCX: VirtPtr);
  21.  
  22. implementation
  23. {$L Pic.OBJ}
  24. procedure pic; external;
  25.  
  26. Procedure SetPCXPal(PCX: VirtPtr;PicSize: LongInt);
  27. var pal : array[0..767] of byte; I: Word;
  28. begin
  29.     PalOffset:=PicSize-768;
  30.     for i:=0 to 767 do pal[i]:=PCX^[PalOffset+i];
  31.     asm  cld; xor di,di; xor bx,bx;
  32.     @L1: mov dx,03c8h; mov ax,bx; out dx,al; inc dx; mov cx,3;
  33.     @L2: mov al,byte ptr pal[di]; shr al,1; shr al,1; out dx,al;
  34.           inc di; loop @L2; inc bx; cmp bx,256; jne @L1; end;
  35. end;
  36.  
  37. procedure ReadObjPcx(gseg: word;PCX: VirtPtr);
  38. var offset,i,j,v,k,count,loop:integer;
  39.      gofs:word;
  40. begin
  41.     offset:=128; gofs:=0; count:=0; j:=200;
  42.     for i := 0 to 351 do begin
  43.         j:=0;
  44.         while j < 310 do begin
  45.             v:=PCX^[offset+count]; inc(count);
  46.             if (v and 192) = 192 then begin
  47.                 loop := v and 63;
  48.                 inc(j,loop);
  49.                 v:=PCX^[offset+count]; inc(count);
  50.                 for k := 1 to loop do begin
  51.                     mem[gseg:gofs] := v;
  52.                     inc(gofs); inc(j);
  53.                 end;
  54.             end
  55.             else begin
  56.                 mem[gseg:gofs] := v;
  57.                 inc(gofs);
  58.             end;
  59.      end;
  60.   end;
  61. end;
  62. end.